import React, { lazy } from "react";
const MainLayout = lazy(() => import("../views/mainLayout"));
const Home = lazy(() => import("../views/home"));
const ListManage = lazy(() => import("../views/list"));
const ListAdd = lazy(() => import("../views/listAdd"));
const Login = lazy(() => import("../views/login"));
const Register = lazy(() => import("../views/register"));
const Set = lazy(() => import("../views/set"));
const NotFound = lazy(() => import("../views/404"));
const ListQwer = lazy(() => import("../views/listQwer"));

export const _menu_routes = [
  {
    path: "/",
    meta: {
      title: "首页",
      icon: <></>,
    },
    element: <Home></Home>,
  },
  {
    path: "/list",
    meta: {
      title: "列表操作",
      icon: <></>,
    },
    children: [
      {
        path: "/list/manage",
        meta: {
          title: "列表管理",
          icon: <></>,
        },
        element: <ListManage></ListManage>,
      },
      {
        path: "/list/options",
        meta: {
          title: "列表操作2",
          icon: <></>,
        },
        children: [{
          path: '/list/options/add',
          meta: {
            title: "列表添加",
            icon: <></>,
          },
          element: <ListAdd></ListAdd>
        },{
          path: '/list/options/qwer',
          meta: {
            title: "列表Qwer",
            icon: <></>,
          },
          element: <ListQwer></ListQwer>
        }]
      },
    ],
  },
  {
    path: "/set",
    meta: {
      title: "设置",
      icon: <></>,
      roles: ['admin']
    },
    element: <Set></Set>,
  },
];

export const _routes = [
  {
    path: "/",
    element: <MainLayout></MainLayout>,
    children: _menu_routes,
  },
  {
    path: "/login",
    element: <Login></Login>,
  },
  {
    path: "/register",
    element: <Register></Register>,
  },
  {
    path: "*",
    element: <NotFound></NotFound>,
  },
];
